using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace VisualTail
{
    public partial class Opciones : Form
    {
        MDI padre = null;

        /// <summary>
        /// Constructor.
        /// </summary>
        public Opciones()
        {
            InitializeComponent();
            //this.ColumnSeleccionarFichero.
        }

        private void Opciones_Load(object sender, EventArgs e)
        {
            padre = (MDI)this.MdiParent;
            if (padre == null) padre = (MDI)this.Owner;

            this.dSWorkflow = padre.ds;
            this.dTRecursoBindingSource.DataSource = padre.ds;
        }


        private void dataGridView4_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //RECURSOS
            DataGridView dg = (DataGridView)sender;
            if (e.RowIndex > -1 && e.ColumnIndex == 1) {
                string tipo = dg.Rows[e.RowIndex].Cells[3].Value.ToString();
                if (tipo.Trim().Equals("")) {
                    MessageBox.Show("Primero ha de seleccionar el tipo de recurso.", "Visual Tail");
                } else {
                    this.openFileDialog1.Filter = "Ficheros " + tipo + "|*." + tipo;
                    if (this.openFileDialog1.ShowDialog() == DialogResult.OK) {
                        dg.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = this.openFileDialog1.FileName;
                    }
                }
            }
        }




        private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e) {

        }

        private void guardarDatosToolStripMenuItem_Click(object sender, EventArgs e) {
            padre.SaveData();
        }

    }
}